package com.wefans.wefansapp.common.tool.popup;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.wefans.wefansapp.R;

public class FindIdDialog extends BaseDialog {

	private Button mBtnClose = null;
	private EditText mEtName = null;
	private EditText mEtNickName = null;
	private Button mBtnShowPartId = null;	
	
	private OnFindIdListener mFindIdListener = null;
	
	public interface OnFindIdListener {
		void onFindPartId(String strName, String strNicName);		
	}
	
	public FindIdDialog(Context mContext, OnFindIdListener findIdListener) {
		super(mContext);
		
		setContentView(R.layout.dialog_find_id);
		
		mBtnClose = (Button)findViewById(R.id.BTN_DIALOG_CLOSE);
		mEtName = (EditText)findViewById(R.id.ET_NAME);
		mEtNickName = (EditText)findViewById(R.id.ET_NICKNAME);
		mBtnShowPartId = (Button)findViewById(R.id.BTN_SHOW_PART_ID);		
		
		mFindIdListener = findIdListener;
		mBtnClose.setOnClickListener(onClickListener);
		mBtnShowPartId.setOnClickListener(onClickListener);
	}

	android.view.View.OnClickListener onClickListener = new android.view.View.OnClickListener() {
		
		public void onClick(View v) {
			
			switch (v.getId()) {
			case R.id.BTN_SHOW_PART_ID:
				if (mFindIdListener != null) {
					mFindIdListener.onFindPartId(mEtName.getText().toString(), 
							 mEtNickName.getText().toString());
				}
				
				dismiss();
				break;
			case R.id.BTN_DIALOG_CLOSE:
				dismiss();
				break;
			}
		}
	};

}
